package com.fs.spring.test.aop.advice;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author shuai.fang
 * @date：2017-08-14
 * @description：
 */
public class GreetingBeforeAdvice implements MethodBeforeAdvice {

	private Logger logger = LoggerFactory.getLogger(getClass());

	public void before(Method method, Object[] objects, Object o) throws Throwable {
		logger.info("method name {}, method -> {}", method.getName(), method);
		logger.info("objects -> {}", Arrays.toString(objects));
		logger.info("object -> {}", o);
		String clientName = (String) objects[0];
		logger.info("How are you! Mr. {} .", clientName);
	}
}
